{% extends "base.html" %}

{% block title %}控制台 - 妙趣拾光锦盒管理系统{% endblock %}

{% block content %}
<div class="row">
    <div class="col-12 mb-4">
        <h2 class="border-bottom pb-2"><i class="fas fa-tachometer-alt me-2"></i>管理控制台</h2>
    </div>
</div>

<!-- 统计卡片 -->
<div class="row mb-4">
    <div class="col-md-3 mb-3">
        <div class="card bg-primary text-white h-100">
            <div class="card-body">
                <div class="d-flex justify-content-between align-items-center">
                    <div>
                        <h6 class="mb-0">总盲盒数量</h6>
                        <h2 class="mb-0 mt-2">{{ stats.total_boxes }}</h2>
                    </div>
                    <i class="fas fa-box fa-3x opacity-50"></i>
                </div>
            </div>
            <div class="card-footer d-flex align-items-center justify-content-between">
                <a href="{{ url_for('blind_box.list') }}" class="text-white text-decoration-none small w-100 d-flex justify-content-between align-items-center">
                    <span>查看详情</span>
                    <i class="fas fa-angle-right"></i>
                </a>
            </div>
        </div>
    </div>
    <div class="col-md-3 mb-3">
        <div class="card bg-success text-white h-100">
            <div class="card-body">
                <div class="d-flex justify-content-between align-items-center">
                    <div>
                        <h6 class="mb-0">合作超市数量</h6>
                        <h2 class="mb-0 mt-2">{{ stats.total_markets }}</h2>
                    </div>
                    <i class="fas fa-shopping-cart fa-3x opacity-50"></i>
                </div>
            </div>
            <div class="card-footer d-flex align-items-center justify-content-between">
                <a href="{{ url_for('supermarket.list') }}" class="text-white text-decoration-none small w-100 d-flex justify-content-between align-items-center">
                    <span>查看详情</span>
                    <i class="fas fa-angle-right"></i>
                </a>
            </div>
        </div>
    </div>
    <div class="col-md-3 mb-3">
        <div class="card bg-warning text-white h-100">
            <div class="card-body">
                <div class="d-flex justify-content-between align-items-center">
                    <div>
                        <h6 class="mb-0">缺货商品</h6>
                        <h2 class="mb-0 mt-2">{{ stats.out_of_stock }}</h2>
                    </div>
                    <i class="fas fa-exclamation-triangle fa-3x opacity-50"></i>
                </div>
            </div>
            <div class="card-footer d-flex align-items-center justify-content-between">
                <a href="{{ url_for('blind_box.list') }}?stock=0" class="text-white text-decoration-none small w-100 d-flex justify-content-between align-items-center">
                    <span>查看详情</span>
                    <i class="fas fa-angle-right"></i>
                </a>
            </div>
        </div>
    </div>
    <div class="col-md-3 mb-3">
        <div class="card bg-danger text-white h-100">
            <div class="card-body">
                <div class="d-flex justify-content-between align-items-center">
                    <div>
                        <h6 class="mb-0">下架商品</h6>
                        <h2 class="mb-0 mt-2">{{ stats.inactive_boxes }}</h2>
                    </div>
                    <i class="fas fa-ban fa-3x opacity-50"></i>
                </div>
            </div>
            <div class="card-footer d-flex align-items-center justify-content-between">
                <a href="{{ url_for('blind_box.list') }}?status=0" class="text-white text-decoration-none small w-100 d-flex justify-content-between align-items-center">
                    <span>查看详情</span>
                    <i class="fas fa-angle-right"></i>
                </a>
            </div>
        </div>
    </div>
</div>

<!-- 快捷操作 -->
<div class="row mb-4">
    <div class="col-12">
        <div class="card shadow-sm">
            <div class="card-header bg-light">
                <h5 class="mb-0"><i class="fas fa-bolt me-2"></i>快捷操作</h5>
            </div>
            <div class="card-body">
                <div class="row">
                    <div class="col-md-3 mb-3">
                        <a href="{{ url_for('blind_box.add') }}" class="btn btn-outline-primary btn-lg d-flex align-items-center justify-content-center gap-2 py-3 w-100">
                            <i class="fas fa-plus-circle fa-lg"></i>
                            <span>添加盲盒</span>
                        </a>
                    </div>
                    <div class="col-md-3 mb-3">
                        <a href="{{ url_for('supermarket.add') }}" class="btn btn-outline-success btn-lg d-flex align-items-center justify-content-center gap-2 py-3 w-100">
                            <i class="fas fa-store fa-lg"></i>
                            <span>添加超市</span>
                        </a>
                    </div>
                    <div class="col-md-3 mb-3">
                        <a href="{{ url_for('order.list') }}" class="btn btn-outline-warning btn-lg d-flex align-items-center justify-content-center gap-2 py-3 w-100">
                            <i class="fas fa-clipboard-list fa-lg"></i>
                            <span>查看订单</span>
                        </a>
                    </div>
                    <div class="col-md-3 mb-3">
                        <a href="{{ url_for('user.list') }}" class="btn btn-outline-info btn-lg d-flex align-items-center justify-content-center gap-2 py-3 w-100">
                            <i class="fas fa-users fa-lg"></i>
                            <span>用户管理</span>
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- 系统概况 -->
<div class="row">
    <div class="col-12">
        <div class="card shadow-sm">
            <div class="card-header bg-light">
                <h5 class="mb-0"><i class="fas fa-info-circle me-2"></i>系统概况</h5>
            </div>
            <div class="card-body">
                <p>妙趣拾光锦盒管理系统是一个专为盲盒零售业务打造的综合管理平台。本系统提供以下核心功能：</p>
                <ul>
                    <li><strong>盲盒商品管理</strong> - 支持添加、编辑、上下架盲盒商品，管理库存、价格、折扣等信息</li>
                    <li><strong>超市合作伙伴管理</strong> - 管理合作超市信息，包括位置、营业时间、评分等</li>
                    <li><strong>订单全流程处理</strong> - 查看和处理订单，跟踪订单状态从待支付到完成的全过程</li>
                    <li><strong>用户账号管理</strong> - 管理用户信息、查看用户订单历史、设置账号权限</li>
                    <li><strong>数据分析与预测</strong> - 提供销售数据分析、用户行为分析、季节性分析和销售预测功能</li>
                    <li><strong>高级分析工具</strong> - 支持类别分析、客户留存分析、转化漏斗分析和价格弹性分析</li>
                </ul>
                <p>通过本系统，管理员可以全方位掌控妙趣拾光锦盒业务，提高运营效率，做出更明智的商业决策，最终提升盲盒零售的整体表现和用户满意度。</p>
            </div>
        </div>
    </div>
</div>
{% endblock %} 